package cn.edu.buu.hospital.service.impl;

import cn.edu.buu.hospital.mapper.MedicalRecordMapper;
import cn.edu.buu.hospital.pojo.MedicalRecord;
import cn.edu.buu.hospital.service.MedicalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("medicalRecordService")
public class MedicalRecordServiceImpl implements MedicalRecordService {

    @Autowired
    private MedicalRecordMapper medicalRecordMapper;

    @Override
    public boolean insert(MedicalRecord medicalRecord) {
        return medicalRecordMapper.insert(medicalRecord) > 0;
    }

    @Override
    public MedicalRecord selectById(Integer id) {
        return medicalRecordMapper.selectById(id);
    }

    @Override
    public MedicalRecord selectByVisitId(Integer visitId) {
        return medicalRecordMapper.selectByVisitId(visitId);
    }

    @Override
    public boolean update(MedicalRecord medicalRecord) {
        return medicalRecordMapper.update(medicalRecord) > 0;
    }

    @Override
    public boolean removeById(Integer id) {
        return medicalRecordMapper.deleteById(id) > 0;
    }
}